/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.metasketch.model.loader;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * @author guilhermegrg
 */
public class GraphNode {

	String tag;

	String id;
	String type;
	String name;
	Map<String, String> properties = new HashMap<String, String>();
	// List<String> childrenIds = new ArrayList<String>();
	List<GraphNode> children = new ArrayList<GraphNode>();

	// List<GraphRelationship> sourceRelationships = new
	// ArrayList<GraphRelationship>();
	// List<GraphRelationship> targetRelationships = new
	// ArrayList<GraphRelationship>();
	// List<GraphRelationship> relationships = new
	// ArrayList<GraphRelationship>();
	// List<GraphNode> sourceNodes = new ArrayList<GraphNode>();
	// List<GraphNode> targetNodes = new ArrayList<GraphNode>();
	// List<GraphNode> relatedNodes = new ArrayList<GraphNode>();

	public GraphNode(String id, String type) {
		this.id = id;
		this.type = type;
	}

	public void addChild(GraphNode node) {
		children.add(node);

	}

	public List<GraphNode> getChildren() {
		return children;
	}

	public void setChildren(List<GraphNode> children) {
		this.children = children;
	}

	public void setProperties(Map<String, String> properties) {
		this.properties = properties;
	}

	public Map<String, String> getProperties() {
		return properties;
	}

	// public List<String> getChildrenIds() {
	// return childrenIds;
	// }

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	// public void addRelationship(GraphRelationship relationship) {
	// relationships.add(relationship);
	//
	// if (relationship.getSource() == this) {
	// sourceRelationships.add(relationship);
	// targetNodes.add(relationship.getTarget());
	// relatedNodes.add(relationship.getTarget());
	// } else if (relationship.getTarget() == this) {
	// targetRelationships.add(relationship);
	// sourceNodes.add(relationship.getSource());
	// relatedNodes.add(relationship.getSource());
	// } else {
	// System.err.println("Relationship added to the wrong Node !!!");
	// }
	//
	// }
	// //
	// // public Collection<GraphRelationship> getRelationships(String type) {
	// //
	// // List<GraphRelationship> relations = new
	// ArrayList<GraphRelationship>();
	// //
	// // for (GraphRelationship relationship : relationships) {
	// // if (relationship.getType().equalsIgnoreCase(type)) {
	// // relations.add(relationship);
	// // }
	// // }
	// //
	// // return relations;
	// // }
	//
	// public Collection<GraphRelationship> getSourceRelationships(String type)
	// {
	//
	// List<GraphRelationship> relations = new ArrayList<GraphRelationship>();
	//
	// for (GraphRelationship relationship : sourceRelationships) {
	// if (relationship.getType().equalsIgnoreCase(type)) {
	// relations.add(relationship);
	// }
	// }
	//
	// return relations;
	// }

	// public Collection<GraphRelationship> getTargetRelationships(String type)
	// {
	//
	// List<GraphRelationship> relations = new ArrayList<GraphRelationship>();
	//
	// for (GraphRelationship relationship : targetRelationships) {
	// if (relationship.getType().equalsIgnoreCase(type)) {
	// relations.add(relationship);
	// }
	// }
	//
	// return relations;
	// }
	//
	// public Collection<GraphNode> getRelatedNodes(String type) {
	//
	// List<GraphNode> nodes = new ArrayList<GraphNode>();
	//
	// for (GraphRelationship relationship : sourceRelationships) {
	// if (relationship.getType().equalsIgnoreCase(type)) {
	// nodes.add(relationship.getTarget());
	// }
	// }
	//
	// for (GraphRelationship relationship : targetRelationships) {
	// if (relationship.getType().equalsIgnoreCase(type)) {
	// nodes.add(relationship.getSource());
	// }
	// }
	//
	// return nodes;
	// }
	//
	// public Collection<GraphNode> getTargetNodes(String type) {
	//
	// List<GraphNode> nodes = new ArrayList<GraphNode>();
	//
	// for (GraphRelationship relationship : sourceRelationships) {
	// if (relationship.getType().equalsIgnoreCase(type)) {
	// nodes.add(relationship.getTarget());
	// }
	// }
	//
	// return nodes;
	// }
	//
	// public Collection<GraphNode> getSourceNodes(String type) {
	//
	// List<GraphNode> nodes = new ArrayList<GraphNode>();
	//
	// for (GraphRelationship relationship : targetRelationships) {
	// if (relationship.getType().equalsIgnoreCase(type)) {
	// nodes.add(relationship.getSource());
	// }
	// }
	//
	// return nodes;
	// }
	//
	// public List<GraphRelationship> getSourceRelationships() {
	// return sourceRelationships;
	// }
	//
	// public List<GraphRelationship> getTargetRelationships() {
	// return targetRelationships;
	// }
	//
	// public List<GraphRelationship> getRelationships() {
	// return relationships;
	// }
	//
	// public List<GraphNode> getRelatedNodes() {
	// return relatedNodes;
	// }
	//
	// public List<GraphNode> getSourceNodes() {
	// return sourceNodes;
	// }
	//
	// public List<GraphNode> getTargetNodes() {
	// return targetNodes;
	// }

}
